package cn.example.vip.mall.goods.controller;

import cn.example.vip.mall.util.RespResult;
import cn.example.vip.mall.goods.entity.SkuAttribute;
import cn.example.vip.mall.goods.service.SkuAttributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin    // 生产环境需要去掉
@RestController
@RequestMapping("/skuAttribute")
public class SkuAttributeController {
	
	@Autowired
	private SkuAttributeService skuAttributeService;
	
	/**
	 * 根据category_attr的属性id查询属性集合
	 */
	@GetMapping("/category/{id}")
	public RespResult<List<SkuAttribute>> categorySkuAttributeList(@PathVariable Integer id) {
		List<SkuAttribute> skuAttributes = skuAttributeService.queryList(id);
		return RespResult.ok(skuAttributes);
	}
}
